Don't unbind port when event channel binding fails.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Thu, 28 Jul 2005 12:33:53 +0000 (12:33 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Thu, 28 Jul 2005 12:33:53 +0000 (12:33 +0000)
This happens when xend tries to introduce the same domain twice.
Signed-off-by: Rusty Russel <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
tools/xenstore/xenstored_domain.c

index 167fa7aa23c0bd31ae19e047a31d4877989a1c7b..ed6cb50599756c5370eb7b1cacc4b6b45c080dce 100644 (file)
@@ -261,8 +261,8 @@ static struct domain *new_domain(void *context, domid_t domid,
 {
        struct domain *domain;
        domain = talloc(context, struct domain);
+       domain->port = 0;
        domain->domid = domid;
-       domain->port = port;
        domain->path = talloc_strdup(domain, path);
        domain->page = xc_map_foreign_range(*xc_handle, domain->domid,
                                            getpagesize(),
@@ -279,9 +279,10 @@ static struct domain *new_domain(void *context, domid_t domid,
        domain->output = domain->page + getpagesize()/2;
 
        /* Tell kernel we're interested in this event. */
-       if (ioctl(eventchn_fd, EVENTCHN_BIND, domain->port) != 0)
+       if (ioctl(eventchn_fd, EVENTCHN_BIND, port) != 0)
                return NULL;
 
+       domain->port = port;
        domain->conn = new_connection(writechn, readchn);
        domain->conn->domain = domain;
        return domain;